﻿namespace FiftyOne.Foundation.Mobile.Detection.Wurfl.Handlers
{
    using System;
    using System.Text.RegularExpressions;

    internal abstract class AlphaNumericHandler : CatchAllHandler
    {
        private Regex _pattern = null;
        private const int CONFIDENCE = 2;

        internal AlphaNumericHandler()
        {
            this._pattern = new Regex(this.Expression, RegexOptions.Compiled);
        }

        protected internal override bool CanHandle(string userAgent)
        {
            return this._pattern.IsMatch(userAgent);
        }

        internal override byte Confidence
        {
            get
            {
                return 2;
            }
        }

        protected abstract string Expression { get; }
    }
}

